set(CLANG_ROOT $ENV{CLANG_ROOT_DIR})
set_ifndef(CLANG_ROOT /usr)
set(COMPILER clang)

if(CONFIG_ARM)
set(triple arm-none-eabi)
set(CMAKE_EXE_LINKER_FLAGS_INIT "--specs=nosys.specs")
elseif(CONFIG_X86)
set(triple i686-pc-none-elf)
endif()

set(CMAKE_C_COMPILER          ${CLANG_ROOT}/bin/clang)
set(CMAKE_C_COMPILER_TARGET   ${triple})
set(CMAKE_ASM_COMPILER_TARGET ${triple})
set(CMAKE_CXX_COMPILER        ${CLANG_ROOT}/bin/clang++)
set(CMAKE_CXX_COMPILER_TARGET ${triple})
set(CMAKE_AR                  "${CLANG_ROOT}/bin/llvm-ar"  CACHE INTERNAL " " FORCE)
set(CMAKE_LINKER              "${CLANG_ROOT}/bin/llvm-link" CACHE INTERNAL " " FORCE)
SET(CMAKE_NM                  "${CLANG_ROOT}/bin/llvm-nm"       CACHE INTERNAL " " FORCE)
SET(CMAKE_OBJDUMP             "${CLANG_ROOT}/bin/llvm-objdump" CACHE INTERNAL " " FORCE)
SET(CMAKE_RANLIB              "${CLANG_ROOT}/bin/llvm-ranlib" CACHE INTERNAL " " FORCE)
set(CMAKE_OBJCOPY             objcopy CACHE INTERNAL " " FORCE)
set(CMAKE_READELF             readelf CACHE INTERNAL " " FORCE)

